package com.itheima.edu.info.manager.day5;

import java.util.Random;
import java.util.Scanner;

public class Test5 {
    public static void main(String[] args) {
        //Random r = new Random();
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入要查找的数据");
        int x = sc.nextInt();
        int[] arr = {1, 2, 3, 4, 5, 6, 7, 8, 9};
        int max = arr[arr.length - 1];
        int min = arr[0];
        while (true) {
            int zhen = (max + min) / 2;
            if (x == arr[zhen - 1]) {
                System.out.println("   aaa" + (zhen - 1));
                break;
            } else if (zhen < x) {
                min = zhen + 1;
            } else if (zhen > x) {
                max = zhen;
            } else {
                System.out.println("并无此数据");
                break;
            }
            if (max == min) {
                System.out.println("并无此数据");
                break;
            }


        }

    }
}
